function throttle(fn, delay) {

    let lock = false;

    return function newFn(...args) {
        // console.log("您好 我是fn的代理 您有什么想跟fn沟通的可以和我说呢亲");

        if (!lock) {
            // 挂锁调用fn
            lock = true
            const result = fn.apply(null, args)

            // 三秒后解锁
            setTimeout(() => {
                lock = false
            }, delay);

            return result
        }

        console.log("fuck off 并且稍后再来");

    }

}

export default (el = new HTMLElement(), binding) => {

    // console.log("binding=", binding);
    // console.log("binding.arg=", binding.arg);
    // const { fn, delay } = binding.value
    // console.log("fn,delay=", fn, delay);

    const { arg: eventType, value: { fn, delay } } = binding
    console.log(eventType, delay, fn);

    const newFn = throttle(fn, delay)

    // 给目标元素添加经过节流处理后的DOM事件侦听器
    el.addEventListener(
        eventType,
        newFn
    )
}